import Channel from '@/components/Channel';
import { useAppSelector } from '@/store';
import { useEffect } from 'react';
import ArticleList from './components/ArticleList';

export default function Home() {
  const { currentId, userList } = useAppSelector((state) => state.channel);
  useEffect(() => {
    return () => {
      console.log('我被卸载了  ----->  ');
    };
  }, []);

  return (
    <div>
      <Channel />
      {userList.map((item) => (
        <ArticleList
          key={item.id}
          style={{ display: item.id === currentId ? 'block' : 'none' }}
          channel_id={item.id}
        />
      ))}
    </div>
  );
}
